package com.zhaopin.controller;

import com.zhaopin.entity.ZhaoForm;
import com.zhaopin.service.ZhaopinService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.bind.DefaultValue;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.client.RestTemplate;

import java.util.Arrays;
import java.util.List;

/**
 * @author yin.peide
 * @date 2021-11-12 16:26
 */
@Controller
@RequestMapping("/zhaopin")
public class ZhaopinController {

    @Autowired
    private ZhaopinService zhaopinService;

    @GetMapping("/{exp}/{userId}/{souFullIndex}/{city}")
    public String getZhaopin(@PathVariable String exp,
                             @PathVariable Integer userId,
                             @PathVariable String souFullIndex,
                             @PathVariable Integer city,
                             Model model) {
        List<ZhaoForm> list = zhaopinService.getZhaopin(userId, souFullIndex, city, exp);
        model.addAttribute("zhaoFormList", list);
        return "zhaopin";
    }

    @RequestMapping("list")
    public String getFreeMarker(Model model) {
        List<String> list = Arrays.asList("xushu", "zhangsan", "lisi");
        model.addAttribute("usernames", list);
        return "list";
    }


}
